<template>
    <div class="newsinfo-container">
        <h3 class="title">
            {{info.title}}
        </h3>
        <p class="sub-title">
            <span>Publish At:{{info.add_time}}</span>
            <span>Hits:{{info.click}}</span>
        </p>

        <hr>
        <div class="content">
            {{info.content}}
        </div>
<!--        评论区-->
<comment-box :id="id"></comment-box>
    </div>
</template>

<script>
import { Toast } from 'mint-ui';
import Comment from '../common/Comment.vue'
export default {
    data:function () {
        return {
            id:this.$route.params.id,
            info:{}
        }
    },
    created:function(){
        this.getNewsInfo()
    },
    methods:{
        getNewsInfo(){
            this.$http.get('/newsinfo/').then(res => {
                if (res.body.code == 200){
                    this.info = res.body.data
                    console.log(res.body)
                }
                else{
                    Toast(res.body.message);
                }
            },err =>{
                // console.log(err)
                Toast(err.statusText);
            })
        }
    },
    components:{
        "comment-box":Comment
    }
}
</script>

<style lang="less">
.newsinfo-container{
    padding: 0 4px;
    .title{
        font-size: 16px;
        text-align: center;
        margin: 10px 0;
        padding-top: 8px;
        color: red;
    }
    .sub-title{
        font-size: 13px;
        color: #226aff;
        display: flex;
        justify-content: space-between;
    }
    .content{

    }
}
</style>